package com.java.basic;

public class BitTests {
    public static void main(String[] args) {
        int a=3;//00000000 00000000 00000000 00000011
        int b=2;//00000000 00000000 00000000 00000010
        System.out.println(a&b);//位与 (两个都是1结果才是1)
        System.out.println(a|b);//位或 (有几个为1结果则为1)
        System.out.println(a^b);//异或 (相同为0不同为1)
        System.out.println(~b);//位非(取反)
    }
}
